<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="keywords" content="<#:C('keyword')#>"/>
    <meta name="description" content="<#:C('content')#>"/>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><#:C('sitename')#>--代理商平台</title>
<include file="Pub:Css"/>
<link rel="stylesheet" href="<#$Theme['P']['root']#>/matrix/css/uniform.css" />
<link rel="stylesheet" href="<#$Theme['P']['root']#>/matrix/css/select2.css" />
</head>
<body>
<include file="Pub:top"/>
<include file="Pub:nav"/>
<!--main-container-part-->
<div id="content">
  <!--breadcrumbs-->
    <div id="content-header">
        <div id="breadcrumb">
            <a href="<#:U('index/index')#>" title="返回首页" class="tip-bottom"><i class="icon-home"></i>首页</a>
            <a href="#" class="current">编辑广告</a>
        </div>
        <h1>编辑广告</h1>
    </div>
    <!--End-breadcrumbs-->
    <div class="container-fluid" >
        <hr>
        <div class="row-fluid">
            <div class="span8">
                <div class="widget-box">
                    <div class="widget-title">
                        <span class="icon"><i class="icon-align-justify"></i></span>
                        <h5>编辑广告</h5>
                    </div>
                    <div class="widget-content nopadding">
                        <form name="doad"  action="__URL__/edit"  method="post" enctype="multipart/form-data" class="form-horizontal">
                            <div class="control-group">
                                <div class="alert span9" style="display: none;margin: 10px 0 10px 150px;">
                                    <span id="alertmsg"></span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">行业分类</label>
                                <div class="controls">
                                    <select name="trade" class="span4">
                                        <option selected = "selected" value="0">
                                            <?php print_r($trade[$info['trade']-1]['txt']); ?>
                                        </option>
                                        <volist name="trade" id="vo">
                                            <option value="<#$vo['key']#>"><#$vo['txt']#></option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">广告名称:</label>
                                <div class="controls">
                                    <input class="span11" type="text"  data-toggle="tooltip" data-trigger="focus" title="请输入标题" data-placement="right" name="title" id="title" value="<#$info['title']#>"/>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">广告备注:</label>
                                <div class="controls">
                                    <textarea class="textarea_editor span11" rows="2" placeholder="输入内容 ..." name="info"><#$info.info|htmlspecialchars_decode#></textarea>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">排序:</label>
                                <div class="controls">
                                    <input class="span11" type="text"  data-toggle="tooltip" data-trigger="focus" title="输入广告投放顺序，数字越大越靠后" data-placement="right" name="sort" id="sort" value="<#$info['sort']#>"/>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">广告图片:</label>
                                <div class="controls">
                                    <img src="<#$info['pic']#>" style="width:200px;"/></br>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">选择广告:</label>
                                <div class="controls">
                                    <input type="file"  name="img" id="upload"/>
                                    <span >上传图片比例建议:760*480</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">投放时间:</label>
                                <div class="controls">
                                    <label>投放时间:</label>
                                     <div class="" id="startdt" data-date="<#$info.startdate|date='Y-m-d',####>" data-date-format="yyyy-mm-dd">
                                      <input type="text" class="span9" value="<#$info.startdate|date='Y-m-d',####>" data-date-format="yyyy-mm-dd" name="startdate" id="startdate" >
                                     </div>
                                      <label>到:</label>
                                      <div id="enddt" data-date="<#$info.enddate|date='Y-m-d',####>" data-date-format="yyyy-mm-dd">
                                      <input type="text" class="span9" value="<#$info.enddate|date='Y-m-d',####>" data-date-format="yyyy-mm-dd" name="enddate" id="enddate" >
                                      </div>
                                </div>
                            </div>
                            <div class="control-group">
                              <input type="hidden" name="id" value="<#$info.id#>">
                              <input type="submit"   class="btn btn-success" id="btn_save" value="保存信息" style="margin: 20px;">
                            &nbsp;
                              <a class="btn btn-primary" href="<#:U('index')#>">返回列表</a>
                            </div>
                        </form>
                    </div>
                    <div class="span4 column pull-right">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="<#$Theme['P']['root']#>/matrix/js/jquery.ui.custom.js"></script> 
<script src="<#$Theme['P']['root']#>/matrix/js/bootstrap.min.js"></script> 
<script src="<#$Theme['P']['root']#>/matrix/js/matrix.js"></script> 
<script src="<#$Theme['P']['root']#>/matrix/js/jquery.uniform.js"></script> 
<script src="<#$Theme['P']['root']#>/matrix/js/select2.min.js"></script> 
<script src="<#$Theme['P']['root']#>/matrix/js/common.js"></script> 
<script src="<#$Theme['P']['root']#>/matrix/js/bootstrap-datepicker.js"></script>

<script type="text/javascript">
    $(function () {
        $('#pushadv').trigger('click');
         var shownow=new Date();
         shownow=shownow.getTime();
       $("#startdate").datepicker().on('changeDate',function(ev){
          var startTime = ev.date.valueOf();
          if(startTime<shownow){
            $("#startdate").focus();
          }
        });
       $("#enddate").datepicker().on('changeDate',function(ev){
         var et = ev.date.valueOf();
         var t=$("#startdate").val();
         if($("#startdate").val()==""){
              $("#enddate").val("");
              alert("请先选择投放时间");
              return;
         }else{
             var dt=Date.parse($("#startdate").val());
             if(et<dt){
               $("#enddate").val($("#startdate").val());
               alert("广告结束时间不能小于开始时间");
              }
         }
         });
        // add uniform plugin styles to html elements
        $("input:checkbox, input:radio,input[type=file]").uniform();

    });
</script>
</body>
</html>
